<template>
	<view class="index_content_basic">
		<view class="index_content_basic_main">
			<u--form :model="ruleForm" :rules="rules" label-position="top" ref="ruleForm" label-width="100px" class="demo-ruleForm">
				 <u-form-item  prop="selfEvaluation">
				    <u-textarea type="textarea" v-model="ruleForm.selfEvaluation"  placeholder="请输入自我评价"></u-textarea>
				  </u-form-item>
			</u--form>
		</view>
		<view class="position_footer flex aic jcsb">
			<u-button class="blue_btn" style="width: 100%;" type="primary" @click="submitForm('ruleForm')">保存</u-button>
		</view>
	</view>
</template>

<script>
	import {
		editResume
	} from "@/api/my.js"
	export default {
		data() {
			return {
				ruleForm: {
					performanceRewardsPunishments:"",
					selfEvaluation: '',
					fullName: "",
					gender:"",
					photoUrl:"",
					politicalOutlook:"",
					keyPopulationInformation:"",
					obeyAdjustment:"",
					currentAddress:"",
					currentWorkUnit:"",
					currentAnnualSalary:"",
					phoneNumber:"",
					idNumber:"",
					brithDay:"",
					age:"",
					startWorkTime:"",
					marriage:"",
					health:"",
					lookingForwardNatureWork:"",
					lookingForwardIndustry:"",
					lookingForwardSalary:"",
					jobSearchStatus:"",
					arrivalTime:""
				},
				rules: {
					selfEvaluation: [{
							required: true,
							message: '请输入自我评价',
							trigger: 'blur'
						}
					]
				}
			};
		},
		onLoad(options) {
			this.datas = JSON.parse(options.data)
			this.info(this.datas)
		},
		methods: {
			info(data) {
				console.log("自我评价",data)
				this.ruleForm = data.personalInformation?data.personalInformation:this.ruleForm
			},
			submitForm(formName) {
				this.$refs.ruleForm.validate().then(res => {
					if (res) {
						let obj = this.datas
						console.log(obj);
						obj.personalInformation = this.ruleForm
						editResume(obj).then(res => {
							uni.showToast({
								title: "保存成功",
								icon: 'success'
							})
						}).catch(res=>{
							uni.showToast({
								title: res.msg,
								icon: 'error'
							})
						})
					} else {
						console.log('error submit!!');
						return false;
					}
				});
			},
			resetForm(formName) {
				this.$refs.ruleForm.resetFields();
			}
		}
	}
</script>

<style lang="scss" scoped>
	.blue_btn {
		height: 40px;
		background: #2F6CBC;
		border: 1px solid #2F6CBC;
	}

</style>
